import request from '@/utils/request'

// 获取分类列表
export function selectSubjectInfos(query) {
    return request({
      url: '/system/subject/selectSubjectInfos',
      method: 'POST',
      data: query,
      headers:{
        'Content-Type':'application/x-www-form-urlencoded	'
      }
    })
}

// 分类 - 添加
export function addSubjectInfo(query) {
  return request({
    url: '/system/subject/addSubjectInfo',
    method: 'POST',
    data: query
  })
}

// 分类 - 通过id获取详情
export function getSubjectInfo(query) {
  return request({
    url: `/system/subject/getSubjectInfo/${query.subjectId}`,
    method: 'get',
    params: query
  })
}

// 分类 - 编辑
export function updateSubjectInfo(query) {
  return request({
    url: `/system/subject/updateSubjectInfo`,
    method: 'post',
    data: query
  })
}

// 分类 - 删除
export function updateStateDel(query) {
  return request({
    url: `/system/subject/updateState/${query.subjectId}/${query.state}}`,
    method: 'get',
    params: query
  })
}

// 期刊列表
export function selectJournalInfos(query) {
  return request({
    url: '/journal/selectJournalInfos',
    method: 'POST',
    data: query
  })
}

// 获取分区列表
export function selectAcademyInfos(query) {
  return request({
    url: '/journal/selectAcademyInfos',
    method: 'GET',
    query: query
  })
}

// 期刊 - 添加
export function addJournalInfo(query) {
  return request({
    url: '/journal/addJournalInfo',
    method: 'POST',
    data: query
  })
}

// 成功案例 - 添加
export function addSuccessfulCase(query) {
  return request({
    url: '/system/successfulCase/addSuccessfulCase',
    method: 'POST',
    data: query
  })
}

// 成功案例 - 列表
export function selectSuccessfulCases(query) {
  return request({
    url: '/system/successfulCase/selectSuccessfulCases',
    method: 'POST',
    data: query
  })
}

// 成功案例 - 编辑
export function updateSuccessfulCase(query) {
  return request({
    url: '/system/successfulCase/updateSuccessfulCase',
    method: 'POST',
    data: query
  })
}

// 成功案例 - 详情
export function getSuccessfulCaseById(query) {
  return request({
    url: `/system/successfulCase/getSuccessfulCaseById/${query.serviceId}`,
    method: 'get',
    query: query
  })
}

// 成功案例 - 删除
export function getServiceRemove(query) {
  return request({
    url: `/system/successfulCase/remove/${query.serviceId}`,
    method: 'post',
    data: query
  })
}

// 成功案例 - 附件 - 删除
export function deleteAttachment(query) {
  return request({
    url: `/system/successfulCase/deleteAttachment/${query.attachmentId}`,
    method: 'get',
    query: query
  })
}

// 成功案例 - 附件 - 添加
export function addAttachment(query) {
  return request({
    url: `/system/successfulCase/addAttachment`,
    method: 'POST',
    data: query
  })
}

// 期刊 - 编辑 - 详细信息
export function getByJournalId(query) {
  return request({
    url: `/journal/getByJournalId/${query.journalId}`,
    method: 'get',
    params: query
  })
}

// 期刊 - 编辑 - 提交
export function updateJournalInfo(query) {
  return request({
    url: `/journal/updateJournalInfo`,
    method: 'post',
    data: query
  })
}

// 期刊 - 删除
export function deleteJournalInfo(query) {
  return request({
    url: `/journal/deleteJournalInfo/${query.journalId}`,
    method: 'post',
  })
}

// 服务 - 列表
export function selectServices(query) {
  return request({
    url: `/system/service/selectServices`,
    method: 'post',
    data:query,
  })
}

// 服务 - 添加
export function addService(query) {
  return request({
    url: '/system/service/addService',
    method: 'POST',
    data: query
  })
}

// 服务 - 编辑
export function serviceUpdateState(query) {
  return request({
    url: `/system/service/updateService`,
    method: 'post',
    data: query
  })
}

// 服务 - 删除
export function serviceDelState(query) {
  return request({
    url: `/system/service/updateState/${query.serviceId}/${query.state}`,
    method: 'get',
    params: query
  })
}

// 服务 - 通过id获取详情
export function getServiceInfo(query) {
  return request({
    url: `/system/service/getServiceInfo/${query.serviceId}`,
    method: 'get',
    params: query
  })
}

// 稿件 - 添加
export function addOrder(query) {
  return request({
    url: `/order/addOrder`,
    method: 'post',
    data: query
  })
}

// 稿件 - 添加
export function addOrderAttachment(query) {
  return request({
    url: `/order/addAttachment`,
    method: 'post',
    data: query
  })
}

// 稿件 - 列表
export function selectOrders(query) {
  return request({
    url: `/order/selectOrders`,
    method: 'post',
    data: query
  })
}

// 稿件 - 列表 - 详情
export function getOrderDetailById(query) {
  return request({
    url: `/order/getOrderDetailById/${query.orderId}`,
    method: 'get',
    params: query
  })
}

// 稿件 -  添加留言
export function addLeaveMessage(query) {
  return request({
    url: `/order/addLeaveMessage`,
    method: 'post',
    data: query
  })
}

// 稿件 -  添加留言
export function updateOrderState(query) {
  return request({
    url: `/order/updateOrderState/${query.orderId}/${query.state}`,
    method: 'post',
    data: query
  })
}

// 前端页面插入
export function addPageValue(query) {
  return request({
    url: `/column/addPageValue`,
    method: 'post',
    data: query
  })
}

// 前端页面更新
export function updatePageValue(query) {
  return request({
    url: `/column/updatePageValue`,
    method: 'post',
    data: query
  })
}

// 前端数据集合
export function selectPages(query) {
  return request({
    url: `/column/selectPages`,
    method: 'get',
    params: query
  })
}

// 获取jcr分区列表
export function selectJcrInfos(query) {
  return request({
    url: `/journal/selectJcrInfos`,
    method: 'get',
    params: query
  })
}

// 通用下载方法
export function download(fileName) {
  window.location.href = "/common/download?fileName=" + encodeURI(fileName) ;
 }


// 常见问题删除
export function recordDelete(query) {
  return request({
    url: `/record/delete/${query.id}`,
    method: 'post',
    data: query
  })
}

